package com.company.project.common.job.task;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.company.project.common.redismq.ZSetVer;
import com.company.project.common.utils.StringUtil;
import com.company.project.entity.TKaiguan;
import com.company.project.mapper.TKaiguanMapper;
import com.company.project.service.RedisService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 测试定时任务(演示Demo，可删除)
 * testTask为spring bean的名称， 方法名称必须是run
 *
 * @author wenbin
 * @version V1.0
 * @date 2020年3月18日
 */
@Slf4j
@Component("callBackYXTask")
public class CallBackYXTask {
	public final static String RS_ZS_MQ_ME = "consumerDelayMessage:";
	@Resource
	public RedisService redisService;
	@Resource
	public TKaiguanMapper tKaiguanMapper;
	@Resource
	private ZSetVer zSetVer;

	public void run(String params){
		String key = "callBackYXTask";
//		String s = redisService.get(RS_ZS_MQ_ME+key);
//		TKaiguan tKaiguan = tKaiguanMapper.selectOne(Wrappers.<TKaiguan>lambdaQuery().eq(TKaiguan::getConsumerDelayMessage, key));
//		System.out.println("callBackYXTask 生产订单 key: " + key + " score："+s);
//		if (tKaiguan == null || StringUtil.equals("false",tKaiguan.getIsok())) {
			zSetVer.consumerDelayMessage(key);
//		}
	}
}
